<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 弹起时触发，按着不松开不触发
        document.onkeyup = function() {
            console.log('d');
        }
        // 按下触发顺序大于press
        document.onkeydown = function() {
            console.log('m');
        }
        // 不能识别功能键
        document.onkeypress = function() {
            console.log('d');
        }
    </script>
</body>
</html>